package chapter5.No5_1_定时器Timer的使用.demo5;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

/**
 * timer.schedule(m1, d, 4000); 按照时间间隔循环执行
 */
public class Main {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.SECOND, -1);
        Date d = c.getTime();
        System.out.println("b预计时间："+d);

        MyTask m1 = new MyTask();

        Timer timer = new Timer();
        timer.schedule(m1, d, 4000);

    }
}
